package com.yty.demo._6_collection;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * @author: yangtaoyao
 * @time: 2020/1/13 14:17
 * @description:
 */
public class MapTest {
    public static void main(String[] args) {
        Map<Integer,String> m=new HashMap<>();

        m.put(1,"111");
        m.put(2,"2222");

        Set<Integer> keys=m.keySet();
        Set<Map.Entry<Integer,String>> entries=m.entrySet();

        System.out.println(m.containsKey(1));
        System.out.println(m.containsValue("111"));

        System.out.println(keys);
        System.out.println(entries);

        System.out.println(m);

        for (Map.Entry<Integer,String> e:entries) {
            System.out.print("["+e.getKey()+","+e.getValue()+"]");
        }
    }
}
